<ion-view view-title="我的账户" cache-view="false">
    <ion-content class="padding has-header">

        <div class="list" ng-if="user.uid>0">

            <div class="item item-avatar">
                <img ng-src="{{user.picture}}">
                <h2>{{user.name}}</h2>
                <img class="item img" src="img/rwm.png" />
            </div>

            <a class="item item-icon-left" href="#/modify-password/checkDigit">
                <i class="icon ion-android-lock"></i> 修改密码
            </a>

            <a class="item item-icon-left" href="#/tabs/change-picture">
                <i class="icon ion-android-person"></i> 修改头像
            </a>
            <a ng-if="user.canUpgrade" class="item item-icon-left" ng-click="upgrade()">
                <i class="icon ion-android-arrow-up"></i> 用户升级
            </a>
            <a class="item item-icon-left" href="#/tabs/consult/1">
                <i class="icon ion-ios-help"></i> 我的问题
            </a>

            <!--<a class="item item-icon-left" href="#/tabs/consult/1">-->
                <!--<i class="icon ion-ios-cart"></i> 我的礼物-->
            <!--</a>-->

            <button class="button button-block button-balanced" ng-click="logout()">
                退出登录
            </button>
        </div>

        <div ng-if="user.uid<=0">
            <div class="list">
                <label class="item item-input">
                    <span class="input-label">用户名</span>
                    <input type="text" ng-model="user.username">
                </label>
                <label class="item item-input">
                    <span class="input-label">密码</span>
                    <input type="password" ng-model="user.password">
                </label>
            </div>
            <div class="padding">
                <button class="button button-block button-balanced" ng-click="login()">
                    登录
                </button>
                <p class="text-center">
                    <a href="#/forgot-password/checkDigit">忘记密码</a>&nbsp&nbsp<a href="#/register">注册</a>
                </p>

                <p>
                    {{message}}
                </p>
            </div>
        </div>
    </ion-content>

    <ion-nav-buttons side="right"  ng-if="ionic.Platform.isAndroid()">
        <button class="button button-icon ion-android-exit" ng-click="exit()"></button>
    </ion-nav-buttons>

</ion-view>